ga.core.validation
Class RuleValidator<T extends IIndividual<T>>

java.lang.Object
  extended by ga.core.validation.RuleValidator<T>
Type Parameters:
T - The generic type of individuals.
All Implemented Interfaces:
IValidator<T>

public class RuleValidator<T extends IIndividual<T>>
extends java.lang.Object
implements IValidator<T>

Validator implementation that uses a set of rules.

Since:
11.08.2012
Author:
Stephan Dreyer

Field Summary
private static java.util.logging.Logger LOGGER
           
private  java.util.List<IValidationRule<T>> mandatoryRules
          These rules must match with mandatoryThreshold.
private  float mandatoryThreshold
           
private  java.util.List<IValidationRule<T>> perfectionRules
          These rules must match with perfectionThreshold.
private  float perfectionThreshold
           
private  java.util.List<IValidationRule<T>> proposedRules
          These rules must match with proposedThreshold.
private  float proposedThreshold
           
 
Constructor Summary
RuleValidator()
           
 
Method Summary
 void addRule(IValidationRule<T> rule)
          Adds a rule to the set of rules.
 boolean isValid(T individual, GAContext context)
          Validates an individual.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

mandatoryRules

private final java.util.List<IValidationRule<T extends IIndividual<T>>> mandatoryRules
These rules must match with mandatoryThreshold.


proposedRules

private final java.util.List<IValidationRule<T extends IIndividual<T>>> proposedRules
These rules must match with proposedThreshold.


perfectionRules

private final java.util.List<IValidationRule<T extends IIndividual<T>>> perfectionRules
These rules must match with perfectionThreshold.


mandatoryThreshold

private final float mandatoryThreshold
See Also:
Constant Field Values

proposedThreshold

private final float proposedThreshold
See Also:
Constant Field Values

perfectionThreshold

private final float perfectionThreshold
See Also:
Constant Field Values
Constructor Detail

RuleValidator

public RuleValidator()
Method Detail

addRule

public void addRule(IValidationRule<T> rule)
Adds a rule to the set of rules.

Parameters:
rule - Rule to add.
Since:
11.08.2012

isValid

public boolean isValid(T individual,
                       GAContext context)
Description copied from interface: IValidator
Validates an individual.

Specified by:
isValid in interface IValidator<T extends IIndividual<T>>
Parameters:
individual - The individual to test for being valid.
context - The GA context.
Returns:
true if the individual is valid, false otherwise.